
import React from 'react';
import agent from 'server';
import Three from 'components/Three';
import styles from './index.module.less';

let ti: any = undefined;

/** 预览 */
export default function Preview() {

    /** Three 控制器 */
    const threeController = React.useMemo(() => new Three.Controller(), [])

    /** 获取数据 */
    React.useEffect(() => {
        clearTimeout(ti);
        ti = setTimeout(async () => {
            await threeController.run(async s => s.model = 'preview');
            await threeController.recover((await agent.get(`/api/project/ldte?${new Date().getTime()}`).over()).body);
        }, 200);
    }, [threeController])

    return (
        <Three
            className={styles.three}
            controller={threeController}
        />
    )
}


